﻿using MiniFox.Platform.Models;
using MiniFox.Platform.OAuth2.Models;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace MiniFox.Platform.OAuth2.Providers
{
    /// <summary>
    /// 
    /// </summary>
    public interface IAccessTokenProvider
    {
        /// <summary>
        /// 校验授权码
        /// </summary>
        /// <param name="appId"></param>
        /// <param name="authCode"></param>
        /// <returns></returns>
        bool VerifyAuthCode(string appId, string authCode);
        /// <summary>
        /// 校验刷新令牌
        /// </summary>
        /// <param name="appId"></param>
        /// <param name="refreshToken"></param>
        /// <returns></returns>
        bool VerifyRenewToken(string appId, string refreshToken);
        /// <summary>
        /// 基于授权码创建token
        /// </summary>
        /// <param name="appId"></param>
        /// <param name="authCode"></param>
        /// <param name="accessTokenExpires"></param>
        /// <param name="renewTokenExpires"></param>
        /// <returns></returns>
        AuthorizeToken CreateAuthorizeToken(string appId, string authCode, int accessTokenExpires, int renewTokenExpires);
        /// <summary>
        /// 获取token
        /// </summary>
        /// <param name="appId"></param>
        /// <param name="refreshToken"></param>
        /// <param name="accessTokenExpires"></param>
        /// <param name="renewTokenExpires"></param>
        /// <param name="renew">是否刷新</param>
        /// <returns></returns>
        AuthorizeToken GetAuthorizeToken(string appId, string refreshToken, int accessTokenExpires, int renewTokenExpires, bool renew);
        /// <summary>
        /// 
        /// </summary>
        /// <param name="accessToken"></param>
        /// <returns></returns>
        AuthorizeToken GetAuthorizeToken(string accessToken);
        /// <summary>
        /// 
        /// </summary>
        /// <param name="accessToken"></param>
        /// <returns></returns>
        OpenAuthIdentity GetIdentity(string accessToken);
        /// <summary>
        /// 
        /// </summary>
        /// <param name="accessToken"></param>
        /// <param name="authScope"></param>
        /// <returns></returns>
        OpenAuthIdentity GetIdentity(string accessToken, AuthScope authScope);
        /// <summary>
        /// 校验客户端
        /// </summary>
        /// <param name="appId"></param>
        /// <param name="secretKey"></param>
        /// <returns></returns>
        bool VerifyClient(string appId, string secretKey);
    }
}
